<%@ page import="bean.PollUser, java.sql.*, connection.*, java.util.*" %>
<jsp:useBean id="user" class="bean.PollUser" scope="request" />
<jsp:setProperty name="user" property="*"/>

<%
/*
PollCreator will want quick access to polls they have created
*/
Connection conn = new DbConnection().getConn();

String username = user.getUsername();
System.out.println(username);
String sql= "SELECT Poll.ID, Poll.Name, Poll.Description, Poll.Version FROM Poll WHERE Poll.Creatorname = '"+username+"'";
System.out.println(sql);
PreparedStatement ps = conn.prepareStatement(sql);
ArrayList<String[]> polls = new ArrayList<String[]>();
boolean hasPolls = false;
try{
	ResultSet rs = ps.executeQuery();
	while(rs.next()){
		hasPolls = true;
		String temp[] = {"", "", "" , ""};
		temp[0] = rs.getString("ID");
		temp[1] = rs.getString("NAME");
		temp[2] = rs.getString("DESCRIPTION");
		temp[3] = rs.getString("VERSION");
		polls.add(temp);
		//temp[3] is reserved for status
	}
}catch(SQLException e){
	System.out.print(e.toString());
}
%>
<div class="entrytitle">
Poll Administration
	<div class="entry">
				<a href="define_poll.jsp"><input type="button" class="button" value="Define poll" style="display:inline"/></a>
				<a href="define_poll.jsp"><input type="button" class="button" value="View administrative report" style="display:inline"/></a>
	</div>
</div>